<?php

namespace Budget\BudgetBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Table(name="planned_expenses")
 * @ORM\Entity(repositoryClass="Budget\BudgetBundle\Repository\PlannedExpenseRepository")
 */
class PlannedExpense
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @Assert\NotBlank()
     * @ORM\Column(type="decimal", precision=10, scale=2)
     */
    protected $amount;
    
    /**
     * @Assert\NotBlank()
     * @ORM\ManyToOne(targetEntity="Category", inversedBy="planned_expenses")
     * @ORM\JoinColumn(name="category_id", referencedColumnName="id")
     */
    protected $category;

    /**
     * @Assert\NotBlank()
     * @ORM\Column(type="datetime")
     */
    protected $date_created;
    
    /**
     * @Assert\NotBlank()
     * @ORM\Column(type="datetime")
     */
    protected $date_expired;

    /**
     * @ORM\ManyToOne(targetEntity="User")
     * @ORM\JoinColumn(name="created_by", referencedColumnName="id")
     */
    protected $created_by;
    
    /**
     * @ORM\ManyToOne(targetEntity="User")
     * @ORM\JoinColumn(name="deleted_by", referencedColumnName="id")
     */
    protected $deleted_by;
            
    /**
     * @ORM\Column(type="string", length=90, nullable=true)
     */
    protected $name;
    
    /**
     * @ORM\Column(type="datetime", nullable=true)
     */
    protected $date_deleted;
    
    /**
     * @ORM\Column(type="datetime", nullable=true)
     */
    protected $date_execution;
    
    /**
     * @ORM\ManyToOne(targetEntity="User", inversedBy="planned_expenses")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
     */
    protected $user;
    
   
    public function __construct()
    {
        $this->setDateCreated(new \DateTime());
    }
    


    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set amount
     *
     * @param string $amount
     * @return PlannedExpense
     */
    public function setAmount($amount)
    {
        $this->amount = $amount;

        return $this;
    }

    /**
     * Get amount
     *
     * @return string 
     */
    public function getAmount()
    {
        return $this->amount;
    }

    /**
     * Set date_created
     *
     * @param \DateTime $dateCreated
     * @return PlannedExpense
     */
    public function setDateCreated($dateCreated)
    {
        $this->date_created = $dateCreated;

        return $this;
    }

    /**
     * Get date_created
     *
     * @return \DateTime 
     */
    public function getDateCreated()
    {
        return $this->date_created;
    }

    /**
     * Set date_expired
     *
     * @param \DateTime $dateExpired
     * @return PlannedExpense
     */
    public function setDateExpired($dateExpired)
    {
        $this->date_expired = $dateExpired;

        return $this;
    }

    /**
     * Get date_expired
     *
     * @return \DateTime 
     */
    public function getDateExpired()
    {
        return $this->date_expired;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return PlannedExpense
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set date_deleted
     *
     * @param \DateTime $dateDeleted
     * @return PlannedExpense
     */
    public function setDateDeleted($dateDeleted)
    {
        $this->date_deleted = $dateDeleted;

        return $this;
    }

    /**
     * Get date_deleted
     *
     * @return \DateTime 
     */
    public function getDateDeleted()
    {
        return $this->date_deleted;
    }

    /**
     * Set date_execution
     *
     * @param \DateTime $dateExecution
     * @return PlannedExpense
     */
    public function setDateExecution($dateExecution)
    {
        $this->date_execution = $dateExecution;

        return $this;
    }

    /**
     * Get date_execution
     *
     * @return \DateTime 
     */
    public function getDateExecution()
    {
        return $this->date_execution;
    }

    /**
     * Set category
     *
     * @param \Budget\BudgetBundle\Entity\Category $category
     * @return PlannedExpense
     */
    public function setCategory(\Budget\BudgetBundle\Entity\Category $category = null)
    {
        $this->category = $category;

        return $this;
    }

    /**
     * Get category
     *
     * @return \Budget\BudgetBundle\Entity\Category 
     */
    public function getCategory()
    {
        return $this->category;
    }

    /**
     * Set created_by
     *
     * @param \Budget\BudgetBundle\Entity\User $createdBy
     * @return PlannedExpense
     */
    public function setCreatedBy(\Budget\BudgetBundle\Entity\User $createdBy = null)
    {
        $this->created_by = $createdBy;

        return $this;
    }

    /**
     * Get created_by
     *
     * @return \Budget\BudgetBundle\Entity\User 
     */
    public function getCreatedBy()
    {
        return $this->created_by;
    }

    /**
     * Set deleted_by
     *
     * @param \Budget\BudgetBundle\Entity\User $deletedBy
     * @return PlannedExpense
     */
    public function setDeletedBy(\Budget\BudgetBundle\Entity\User $deletedBy = null)
    {
        $this->deleted_by = $deletedBy;

        return $this;
    }

    /**
     * Get deleted_by
     *
     * @return \Budget\BudgetBundle\Entity\User 
     */
    public function getDeletedBy()
    {
        return $this->deleted_by;
    }

    /**
     * Set user
     *
     * @param \Budget\BudgetBundle\Entity\User $user
     * @return PlannedExpense
     */
    public function setUser(\Budget\BudgetBundle\Entity\User $user = null)
    {
        $this->user = $user;

        return $this;
    }

    /**
     * Get user
     *
     * @return \Budget\BudgetBundle\Entity\User 
     */
    public function getUser()
    {
        return $this->user;
    }
}
